/**
 * 
 */
package com.huarui.desktop.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.ewaf.framework.dao.impl.BaseDaoImpl;
import org.ewaf.framework.model.PagingSummary;

import com.huarui.desktop.dao.DesktopDao;
import com.huarui.desktop.model.Desktop;

/**
 * @author peng.sunp
 * 
 */
public class DesktopDaoImpl extends BaseDaoImpl  implements DesktopDao {


	@SuppressWarnings("unchecked")
	public List<Desktop> selectDesktops(Desktop desktop,
			PagingSummary summary) {
		HashMap<String, Object> params = new HashMap<String, Object>();
		params.put("start", summary.getStart());
		params.put("limit", summary.getLimit());
		return (List<Desktop>) getSqlMapClientTemplate().queryForList(
				namespace + ".selectDesktops", params);
	}

	public int selectDesktopsCount(Desktop desktop) {
		HashMap<String, Object> params = new HashMap<String, Object>();
		return (Integer) getSqlMapClientTemplate().queryForObject(
				namespace + ".selectDesktopsCount", params);

	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see com.huarui.desktop.dao.DesktopDao#selectDesktop(java.lang.Integer)
	 */
	@Override
	public Desktop selectDesktopByCompanyType(Integer companyType,Integer desktopTarget) {
		HashMap<String, Integer> params = new HashMap<String, Integer>();
		params.put("companyType", companyType);
		params.put("desktopTarget", desktopTarget);
		return (Desktop) getSqlMapClientTemplate().queryForObject(namespace + ".selectByCompanyType", params);
	}

}
